//
//  LSZContentTableViewCell.m
//  JKFuYinProject
//
//  Created by 九酷 on 2017/12/22.
//  Copyright © 2017年 LC. All rights reserved.
//

#import "LSZContentTableViewCell.h"

@implementation LSZContentTableViewCell
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.labelTitle = [[UILabel alloc]init];
        self.labelTitle.textColor = titleColorLSZ;
        [self addSubview:self.labelTitle];

        self.imageViewHeader = [[UIImageView alloc]init];
        [self.imageViewHeader.layer setMasksToBounds:YES];
        [self.imageViewHeader.layer setCornerRadius:18.5];
        [self addSubview:self.imageViewHeader];

        self.labelName = [[UILabel alloc]init];
        self.labelName.textColor = titleColorLSZ;
        [self addSubview:self.labelName];

        self.labelTime= [[UILabel alloc]init];
        self.labelTime.textColor = lightColor;
        [self addSubview:self.labelTime];

        self.butFocusOn = [[UIButton alloc]init];
        self.butFocusOn.backgroundColor = redUIColor;
        [self.butFocusOn setTitle:@" + 关注" forState:UIControlStateNormal];
        [self.butFocusOn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        self.butFocusOn.titleLabel.font = FONT_(14);
        [self.butFocusOn.layer setMasksToBounds:YES];
        [LSZSpecialPackaging setLabelAdaptiveSize:self.butFocusOn.titleLabel font:15];
        [self addSubview:self.butFocusOn];

        self.labelType = [[UILabel alloc]init];
        self.labelType.textColor = lightColor;
        self.labelType.hidden = YES;
        [self addSubview:self.labelType];

        self.labelBigType = [[UILabel alloc]init];
        self.labelBigType.font = FONT_12;
        self.labelBigType.textColor = lightColor;
        self.labelBigType.text = @"祷告";
        self.labelBigType.hidden = YES;
        [self addSubview:self.labelBigType];

        self.imageViewYuan = [[UIImageView alloc]init];
        self.imageViewYuan.image = [UIImage imageNamed:@"橘色圆圈"];
        self.imageViewYuan.hidden = YES;
        [self addSubview:self.imageViewYuan];

        self.imageViewUp = [[UIImageView alloc]init];
        [self.imageViewUp.layer setMasksToBounds:YES];
        [self.imageViewUp.layer setCornerRadius:5];
        self.imageViewUp.image = [UIImage imageNamed:@"index_audio_image4"];
        self.imageViewUp.contentMode = UIViewContentModeScaleAspectFill;
        [self addSubview:self.imageViewUp];

        self.labelConunt = [[UILabel alloc]init];
        self.labelConunt.numberOfLines = 0;
        self.labelConunt.textColor = titleColorLSZ;
        [self addSubview:self.labelConunt];

        self.butBenediction = [[UIButton alloc]init];
        [self.butBenediction.layer setMasksToBounds:YES];
        self.butBenediction.backgroundColor = redUIColor;
        [self addSubview:self.butBenediction];

        self.imageViewBenediction = [[UIImageView alloc]init];
        self.imageViewBenediction.image = [UIImage imageNamed:@"送祝福_白莲花"];
        [self.butBenediction addSubview:self.imageViewBenediction];

        self.labelBenediction = [[UILabel alloc]init];
        self.labelBenediction.textColor = [UIColor whiteColor];
        self.labelBenediction.text = @"送祝福";
        [self.butBenediction addSubview:self.labelBenediction];

        if (ScreenWidth == 320) {
            //5
            self.labelName.font = FONT_(13.5);
            self.labelTime.font = FONT_(12.5);
            self.labelType.font = FONT_(11.5);
            self.labelBigType.font = FONT_(11.5);
            self.labelTitle.font= FONT_(13.5);
            self.labelConunt.font = FONT_(13.5);
            self.labelBenediction.font = FONT_(13.5);

            self.labelTitle.frame = CGRectMake(15,10, ScreenWidth-30, 16);
            self.imageViewHeader.frame = CGRectMake(15, 10+CGRectGetMaxY(self.labelTitle.frame), 37, 37);
            [self.imageViewHeader.layer setCornerRadius:18.5];
            self.labelName.frame = CGRectMake(CGRectGetMaxX(self.imageViewHeader.frame)+10, 10+CGRectGetMaxY(self.labelTitle.frame), ScreenWidth/3*2, 15);

            self.labelTime.frame = CGRectMake(CGRectGetMaxX(self.imageViewHeader.frame)+10, CGRectGetMaxY(self.labelName.frame)+3,ScreenWidth-CGRectGetMaxX(self.imageViewHeader.frame)-10, 14);

            self.butFocusOn.frame = CGRectMake(ScreenWidth-10-70, CGRectGetMinY(self.imageViewHeader.frame)+5, 70,self.imageViewHeader.frame.size.height-10);
            [self.butFocusOn.layer setCornerRadius:self.butFocusOn.frame.size.height/2];
            self.labelType.frame = CGRectMake(ScreenWidth-50-43,(37-14)/2+CGRectGetMinY(self.imageViewHeader.frame), 80, 14);
            self.labelBigType.frame = CGRectMake(CGRectGetMinX(self.labelType.frame)-26, (37-14)/2+CGRectGetMinY(self.imageViewHeader.frame),26, 14);
            self.imageViewYuan.frame = CGRectMake(CGRectGetMinX(self.labelBigType.frame)-17,(37-14)/2+CGRectGetMinY(self.imageViewHeader.frame)+1, 12, 12);

            self.imageViewUp.frame = CGRectMake(15, CGRectGetMaxY(self.imageViewHeader.frame)+14, ScreenWidth-30, 200);
            self.labelConunt.frame = CGRectMake(15, CGRectGetMaxY(self.imageViewUp.frame)+8, ScreenWidth-30, 65);
            self.labelBenediction.frame = CGRectMake(15, CGRectGetMaxY(self.labelConunt.frame), ScreenWidth-30, 14);

            self.butBenediction.frame = CGRectMake((ScreenWidth-100)/2, 28+CGRectGetMaxY(self.labelConunt.frame), 100, 30);
            [self.butBenediction.layer setCornerRadius:15];
            self.imageViewBenediction.frame = CGRectMake(12,(self.butBenediction.frame.size.height-14)/2, 28, 14);
            self.labelBenediction.frame = CGRectMake(CGRectGetMaxX(self.imageViewBenediction.frame)+4,(self.butBenediction.frame.size.height-14)/2, 50, 14);
        }else if(ScreenWidth == 375){
            // 6 7
            self.labelName.font = FONT_(14);
            self.labelTime.font = FONT_(13);
            self.labelType.font = FONT_(12);
            self.labelBigType.font = FONT_(12);
            self.labelTitle.font= FONT_(14);
            self.labelConunt.font = FONT_(14);
            self.labelBenediction.font = FONT_(14);
            self.labelTitle.frame = CGRectMake(15,10, ScreenWidth-30, 18);
            self.imageViewHeader.frame = CGRectMake(15, 10+CGRectGetMaxY(self.labelTitle.frame), 38, 38);
            [self.imageViewHeader.layer setCornerRadius:19];
            self.labelName.frame = CGRectMake(CGRectGetMaxX(self.imageViewHeader.frame)+10, 10+CGRectGetMaxY(self.labelTitle.frame), ScreenWidth/3*2, 18);
            self.labelTime.frame = CGRectMake(CGRectGetMaxX(self.imageViewHeader.frame)+10, CGRectGetMaxY(self.labelName.frame)+3,ScreenWidth-CGRectGetMaxX(self.imageViewHeader.frame)-10, 15);
            self.butFocusOn.frame = CGRectMake(ScreenWidth-10-70, CGRectGetMinY(self.imageViewHeader.frame)+5, 70,self.imageViewHeader.frame.size.height-10);
            [self.butFocusOn.layer setCornerRadius:self.butFocusOn.frame.size.height/2];
            self.labelType.frame = CGRectMake(ScreenWidth-50-43, (38-15)/2+CGRectGetMinY(self.imageViewHeader.frame) , 80, 15);
            self.labelBigType.frame = CGRectMake(CGRectGetMinX(self.labelType.frame)-28, (38-16)/2+CGRectGetMinY(self.imageViewHeader.frame),28, 15);
            self.imageViewYuan.frame = CGRectMake(CGRectGetMinX(self.labelBigType.frame)-17,(38-16)/2+CGRectGetMinY(self.imageViewHeader.frame)+1.5, 12, 12);

            self.imageViewUp.frame = CGRectMake(15, CGRectGetMaxY(self.imageViewHeader.frame)+14, ScreenWidth-30, 220);
            self.labelConunt.frame = CGRectMake(15, CGRectGetMaxY(self.imageViewUp.frame)+8, ScreenWidth-30, 65);
            self.labelBenediction.frame = CGRectMake(15, CGRectGetMaxY(self.labelConunt.frame), ScreenWidth-30, 16);

            self.butBenediction.frame = CGRectMake((ScreenWidth-100)/2, 28+CGRectGetMaxY(self.labelConunt.frame), 100, 32);
            [self.butBenediction.layer setCornerRadius:16];
            self.imageViewBenediction.frame = CGRectMake(12,(self.butBenediction.frame.size.height-16)/2, 28, 16);
            self.labelBenediction.frame = CGRectMake(CGRectGetMaxX(self.imageViewBenediction.frame)+4,(self.butBenediction.frame.size.height-16)/2, 50, 16);
        }else {
            //plus
            self.labelName.font = FONT_(15.5);
            self.labelTime.font = FONT_(15);
            self.labelType.font = FONT_(14);
            self.labelBigType.font = FONT_(14);
            self.labelTitle.font= FONT_(15.5);
            self.labelConunt.font = FONT_(15);
            self.labelBenediction.font = FONT_(14.5);
 
            self.labelTitle.frame = CGRectMake(15, 10, ScreenWidth-30, 20);

            self.imageViewHeader.frame = CGRectMake(15, CGRectGetMaxY(self.labelTitle.frame)+10, 39, 39);
            [self.imageViewHeader.layer setCornerRadius:19.5];
            self.labelName.frame = CGRectMake(CGRectGetMaxX(self.imageViewHeader.frame)+10, CGRectGetMaxY(self.labelTitle.frame)+10, ScreenWidth/3*2, 20);
            self.labelTime.frame = CGRectMake(CGRectGetMaxX(self.imageViewHeader.frame)+10, CGRectGetMaxY(self.labelName.frame)+3,ScreenWidth-CGRectGetMaxX(self.imageViewHeader.frame)-10, 16);
            self.butFocusOn.frame = CGRectMake(ScreenWidth-10-70, CGRectGetMinY(self.imageViewHeader.frame)+5, 70,self.imageViewHeader.frame.size.height-10);
            [self.butFocusOn.layer setCornerRadius:self.butFocusOn.frame.size.height/2];
            self.labelType.frame = CGRectMake(ScreenWidth-50-43, (39-16)/2+CGRectGetMinY(self.imageViewHeader.frame),80, 16);
            self.labelBigType.frame = CGRectMake(CGRectGetMinX(self.labelType.frame)-30, (39-16)/2+CGRectGetMinY(self.imageViewHeader.frame),30, 16);
            self.imageViewYuan.frame = CGRectMake(CGRectGetMinX(self.labelBigType.frame)-17,(39-16)/2+CGRectGetMinY(self.imageViewHeader.frame)+2, 12, 12);

            self.imageViewUp.frame = CGRectMake(15, CGRectGetMaxY(self.imageViewHeader.frame)+14, ScreenWidth-30, 240);
            self.labelConunt.frame = CGRectMake(15, CGRectGetMaxY(self.imageViewUp.frame)+8, ScreenWidth-30, 65);
            self.labelBenediction.frame = CGRectMake(15, CGRectGetMaxY(self.labelConunt.frame), ScreenWidth-30, 18);

            self.butBenediction.frame = CGRectMake((ScreenWidth-100)/2, 28+CGRectGetMaxY(self.labelConunt.frame), 100, 34);
            [self.butBenediction.layer setCornerRadius:17];
            self.imageViewBenediction.frame = CGRectMake(12,(self.butBenediction.frame.size.height-18)/2, 28, 18);
            self.labelBenediction.frame = CGRectMake(CGRectGetMaxX(self.imageViewBenediction.frame)+4,(self.butBenediction.frame.size.height-18)/2, 50, 18);
        }
    }
    return self;
}
@end
